#include "RstpData.h"
#include "CommonOpt.h"


UInt32 SDataHeader::OutAsData( char * outBuf, UInt32 bufLen )
{
	if(!outBuf || bufLen < Size())
		return 0;
	
	PacketHandler Handler(outBuf,bufLen);
	Handler<<SeqNo<<Flag<<TimeStamp;
	return Handler.Size();
}

Bool SDataHeader::Parse( const char * pBuff, UInt32 vBuffLen )
{
	if(!pBuff || vBuffLen < Size())
		return FALSE;
	
	PacketHandler Handler(pBuff,vBuffLen);
	Handler>>SeqNo>>Flag>>TimeStamp;
	if(Handler.Size() == Size())
		return TRUE;
	return FALSE;
}
